/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx.serviet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * <p>Project: javaweb - Timers
 * <p>Powered by webrx On 2022-03-14 14:57:24
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
@WebServlet(urlPatterns = {"/timers","/api/t1"})
public class Timers extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        //System.out.println(req.getMethod());
        if(req.getParameter("id")!=null) {
            //System.out.println(req.getParameter("id"));
            //System.out.println(req.getParameter("name"));
        }


        System.out.println(req.getParameter("id"));
        System.out.println(req.getParameter("name"));



        resp.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");
        PrintWriter out = resp.getWriter();
        String ts = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        out.print(ts);
        //System.out.println(req.getRemoteAddr()+":"+ts);
        out.flush();
        out.close();
    }
}
